package com.ki.erp.controller;

import com.ki.erp.req.PwdLoginReq;
import com.ki.erp.service.LoginService;
import com.ki.erp.vo.R;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController {
    private @Resource LoginService loginService;

    @PostMapping("/PwdAccess")
    public R loginByPwd(@RequestBody PwdLoginReq req) {
        return R.success(loginService.login(req));
    }

    @PostMapping("/Logout")
    public R logout() {
        loginService.logout();
        return R.success();
    }
}
